package router

import (
	"APi/service/MealProduct"
	order2 "APi/service/order"
	user2 "APi/service/user"
	"common/globals"
	"common/pkg"
	"github.com/gin-gonic/gin"
)

func LoadRouter(r *gin.Engine) {
	r.POST("/callback", order2.CallBack)
	user := r.Group("/user")
	{
		user.POST("/login", user2.LoginUser)
		user.Use(pkg.JWTAuth(globals.JWTSecret))
		user.GET("/my/coupon/list", user2.ListUserCoupon)
		user.GET("/all/coupon/list", user2.CouponList)
		user.POST("/coupon/add", user2.CouponAdd)
		user.POST("/upload", user2.Upload)
		user.GET("/order/list", user2.OrderList)
	}
	meal := r.Group("/meal")
	{
		meal.Use(pkg.JWTAuth(globals.JWTSecret))
		meal.GET("/list", MealProduct.ListMealProduct)
	}
	order := r.Group("/order")
	{
		order.Use(pkg.JWTAuth(globals.JWTSecret))
		order.POST("/add", order2.AddOrder)
	}
}
